package paidaxing.blog.core.service.impl;


import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import paidaxing.blog.core.annotation.LogRecord;
import paidaxing.blog.core.mapper.LogRecordMapper;
import paidaxing.blog.core.service.LogRecordService;

/**
 * 日志记录service层
 *
 * @author heefM
 * @date 2025-10-28
 */
@Service
public class LogRecordServiceImpl implements LogRecordService {
    
    @Autowired
    private LogRecordMapper logRecordMapper;
    
    @Async
    @Override
    public void saveLog(LogRecord logRecord) {
        try {
            logRecordMapper.insert(logRecord);
        } catch (Exception e) {
            // 日志记录失败不应该影响主业务流程
            System.err.println("保存操作日志失败: " + e.getMessage());
        }
    }


}
